home *** CD-ROM | disk | FTP | other *** search
- property pNetQueue, pNetProcess, pStartTimer, pMaxTime, pStepframe
- global gNetQueue, gTracker
-
- on new me
- pStartTimer = 0
- pMaxTime = 900
- pStepframe = "none"
- pNetQueue = []
- pNetProcess = []
- (the actorList).add(me)
- return me
- end
-
- on mDestruct me
- counter = pNetProcess.count
- repeat with i = 1 to counter
- pNetProcess[1].mDestruct()
- pNetProcess[1] = 0
- pNetProcess.deleteAt(1)
- end repeat
- counter = pNetQueue.count
- repeat with i = 1 to counter
- pNetQueue[1].mDestruct()
- pNetQueue[1] = 0
- pNetQueue.deleteAt(1)
- end repeat
- (the actorList).deleteOne(me)
- end
-
- on mFileTheResults me, vResult
- put vResult
- gTracker.p12345 = vResult
- pStepframe = "none"
- end
-
- on mGetNetText me, url, callBackMethod, callBackObject
- tempNetObject = new(script("netOperations parent"), #GET, url, callBackMethod, callBackObject)
- me.mQueueNetObject(tempNetObject)
- pStartTimer = the timer
- end
-
- on mPostNetText me, url, propertyList, callBackMethod, callBackObject
- tempNetObject = new(script("netOperations parent"), #POST, url, callBackMethod, callBackObject, propertyList)
- me.mQueueNetObject(tempNetObject)
- end
-
- on mPreloadNetThing me, url, callBackMethod, callBackObject
- tempNetObject = new(script("netOperations parent"), #preload, url, callBackMethod, callBackObject)
- me.mQueueNetObject(tempNetObject)
- end
-
- on mDownloadNetThing me, url, localFile, callBackMethod, callBackObject
- tempNetObject = new(script("netOperations parent"), #download, url, callBackMethod, callBackObject, VOID, localFile)
- me.mQueueNetObject(tempNetObject)
- end
-
- on mQueueNetObject me, whichObj
- if pNetProcess.count < 4 then
- whichObj.mExecuteNetCommand()
- pNetProcess.append(whichObj)
- else
- pNetQueue.append(whichObj)
- end if
- end
-
- on stepFrame me
- case pStepframe of
- "none":
- nothing()
- "waiting":
- if the timer > (pStartTimer + pMaxTime) then
- pStepframe = "timed out"
- end if
- if pNetProcess.count then
- counter = 1
- repeat while counter <= pNetProcess.count
- if pNetProcess[counter].mIsNetOpDone() then
- pNetProcess[counter].mCallBackResults()
- pNetProcess[counter].mDestruct()
- pNetProcess[counter] = 0
- pNetProcess.deleteAt(counter)
- next repeat
- end if
- counter = counter + 1
- end repeat
- if (pNetProcess.count <= 4) and pNetQueue.count then
- repeat while (pNetProcess.count < 4) and (pNetQueue.count <> 0)
- pNetProcess.append(pNetQueue[1])
- mExecuteNetCommand(pNetProcess.getLast())
- pNetQueue.deleteAt(1)
- end repeat
- end if
- end if
- "timed out":
- pStepframe = "none"
- gTracker.p12345 = EMPTY
- end case
- end
-